/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.common.dto;

import java.util.Set;
import java.util.List;
import java.util.ArrayList;

import com.javaeye.common.dto.DTO;

public class Role implements DTO {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -5246378027372300440L;

	private int id;
	
	private String name;
	
	private String description;
	
	private Set<Module> modules;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setModules(Set<Module> modules) {
		this.modules = modules;
	}

	public Set<Module> getModules() {
		return modules;
	}
	
	public List<Integer> getModuleIds() {
		List<Integer> result = new ArrayList<Integer>();
		for (Module m : modules) {
			result.add(m.getId());
		}
		return result;
	}
}
